<?php

use think\migration\Migrator;
use think\migration\db\Column;

class ControlSettingTarget extends Migrator
{
    /**
     * 管控 - 设置 - 目标制定
     */
    public function change()
    {
        $table = $this->table('control_setting_target');
        $table
            //step1:污染物名称
            ->addColumn('type', 'string', ['limit' => 50, 'comment' => '污染物类型:SO2,NOX',])
            //step2:相关管控ID
            ->addColumn('plan_id', 'integer', ['limit' => 4, 'comment' => '管控预案的ID',])
            //step3:列表中相关ID
            ->addColumn('company_id', 'integer', ['limit' => 11, 'comment' => '超标的企业的ID',])
            ->addColumn('drain_id', 'integer', ['limit' => 11, 'comment' => '排口ID',])
            ->addColumn('drain_name', 'string', ['limit' => 20, 'comment' => '排口名称',])
            //排放量
            ->addColumn('emissions', 'string', ['limit' => 50, 'comment' => '排放量',])
            //step4:相关其他ID
            ->addColumn('industry_id', 'integer', ['limit' => 4, 'comment' => '行业ID',])
            //插入时间
            ->addColumn('create_time', 'integer', ['limit' => 11, 'comment' => '插入时间',])
            //注释
            ->setComment('管控 - 设置 - 目标制定')
            //引擎
            ->setEngine('InnoDB')
            ->save();
    }
}
